﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using AgileShare.Framework.Core;

namespace AgileShare.Framework.Library.Helpers
{
    /// <summary>
    /// This class contains helper methods for working with SharePoint Features
    /// - All methods should be static
    /// - DO NOT USE SPContext
    /// </summary>
    public class FeatureHelper
    {
		private static void WaitUntilWebProvisioned(SPWeb web)
		{
			SPSite site = web.Site;
			bool provisioned = web.Provisioned;
			while (!provisioned)
			{
				using (SPWeb oWeb = site.OpenWeb())
				{
					provisioned = oWeb.Provisioned;
					if (!provisioned)
					{
						System.Threading.Thread.Sleep(5000);
						TraceProvider.Log("Web not provisioned, waiting 5 seconds", TraceProviderCategories.Default, (uint)TraceProviderEventIds.Feature, TraceProviderSeverity.Monitorable);
					}
				}
			}
		}
    }
}
